package com.leinao.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

/**
 * 
 * 环境变量配置
 * @author  wangshoufa 
 * @date 2018年11月7日 下午3:51:13
 *
 */
@RefreshScope
@Component
public class EnvironmentConfig {
	
	/**
	 * 前缀
	 */
	@Value("${remote.prefix}")
	private String prefix;
	
	/**
	 * 单位:s
	 */
	@Value("${remote.expireSeconds}")
	private Integer expireSeconds;

	/**
	 * redis的ip
	 */
	@Value("${spring.redis.host}")
    private String host;

    /**
     * redis端口号
     */
    @Value("${spring.redis.port}")
    private Integer port;

    /**
     * redis密码
     */
    @Value("${spring.redis.password}")
    private String password;

    /**
     * redis连接超时时间
     */
    @Value("${spring.redis.timeout}")
    private Integer timeout;

    /**
     * redis连接池中的最大空闲连接
     */
    @Value("${spring.redis.pool.max-idle}")
    private Integer maxIdle;

    /**
     * 连接池最大阻塞等待时间（使用负值表示没有限制）
     */
    @Value("${spring.redis.pool.max-wait}")
    private Long maxWaitMillis;

    /**
     * 调用文件中心url
     */
	@Value("${remote.pai.file.center.url}")
	private String fileCenterUrl;

	/**
	 * 文件路径前缀
	 */
	@Value("${projectPath}")
    private String projectPath;
	
	/**
	 * 数据库驱动名称
	 */
	@Value("${jdbc.driverClassName}")
	private String jdbcDriverClassName;

	/**
	 * 数据库url
	 */
	@Value("${jdbc.url}")
	private String jdbcUrl;

	/**
	 * 数据库用户名
	 */
	@Value("${jdbc.username}")
	private String jdbcUsername;

	/**
	 * 数据库密码
	 */
	@Value("${jdbc.password}")
	private String jdbcPassword;

	/**
	 * 彼塔社区服务地址
	 */
	@Value("${remote.bitahub.service.url}")
	private String bitahubServiceUrl;

	/**
	 * 用户中心服务地址
	 */
	@Value("${remote.userCenter.service.url}")
	private String userCenterServiceUrl;

	/**
	 * pai2.0地址
	 */
	@Value("${remote.pai.web.url}")
	private String paiWebUrl;

	/**
	 * 
	 * 获取剩余算力
	 */
	@Value("${remote.user.calculationPower.url}")
	private String userCalculationPowerUrl;
	
	/**
	 * 
	 * 算力下限
	 *
	 */
	@Value("${remote.user.calculationPower.limit}")
	private BigDecimal userCalculationPowerLimit;
	
	/**
	 * 
	 * 调用framework获取任务明细
	 */
	@Value("${remote.frameworksUrl}")
	private String frameworksUrl;
	
	/**
	 * 每天调式debug的最大的任务数
	 */
	@Value("${remote.dayMaxDebugJobs}")
	private Integer dayMaxDebugJobs;

	/**
	 * rest-server地址
	 */
	@Value("${rest.server.url}")
	private String restServerUrl;

	/**
	 * tensorboard服务地址
	 */
	@Value("${remote.usercenter.tsb.url}")
	private String userCenterTsbUrl;

	/**
	 * tensorboard服务地址
	 */
	@Value("${remote.tensorboard.service.url}")
	private String tensorboardUrl;

	/**
	 * tensorboard服务地址
	 */
	@Value("${remote.tensorboard.domain.url}")
	private String tensorboardDomain;

	/**
	 * 事例项目ID信息
	 */
	@Value("${example.project.id}")
	private Long exampleProjectId;

	/**
	 * 事例项目Job ID信息,多个任务逗号隔开
	 */
	@Value("${example.project.job.ids}")
	private String exampleProjectJobIds;

	public String getPrefix() {
		return prefix;
	}

	public Integer getExpireSeconds() {
		return expireSeconds;
	}

	public String getHost() {
		return host;
	}

	public Integer getPort() {
		return port;
	}

	public String getPassword() {
		return password;
	}

	public Integer getTimeout() {
		return timeout;
	}

	public Integer getMaxIdle() {
		return maxIdle;
	}

	public Long getMaxWaitMillis() {
		return maxWaitMillis;
	}

	public String getFileCenterUrl() {
		return fileCenterUrl;
	}

	public String getBitahubServiceUrl() {
		return bitahubServiceUrl;
	}

	public String getUserCenterServiceUrl() {
		return userCenterServiceUrl;
	}

	public String getPaiWebUrl() {
		return paiWebUrl;
	}

	public String getProjectPath() {
		return projectPath;
	}

	public String getJdbcDriverClassName() {
		return jdbcDriverClassName;
	}

	public void setJdbcDriverClassName(String jdbcDriverClassName) {
		this.jdbcDriverClassName = jdbcDriverClassName;
	}

	public String getJdbcUrl() {
		return jdbcUrl;
	}

	public void setJdbcUrl(String jdbcUrl) {
		this.jdbcUrl = jdbcUrl;
	}

	public String getJdbcUsername() {
		return jdbcUsername;
	}

	public void setJdbcUsername(String jdbcUsername) {
		this.jdbcUsername = jdbcUsername;
	}

	public String getJdbcPassword() {
		return jdbcPassword;
	}

	public void setJdbcPassword(String jdbcPassword) {
		this.jdbcPassword = jdbcPassword;
	}

	public String getUserCalculationPowerUrl() {
		return userCalculationPowerUrl;
	}

	public void setUserCalculationPowerUrl(String userCalculationPowerUrl) {
		this.userCalculationPowerUrl = userCalculationPowerUrl;
	}

	public BigDecimal getUserCalculationPowerLimit() {
		return userCalculationPowerLimit;
	}

	public void setUserCalculationPowerLimit(BigDecimal userCalculationPowerLimit) {
		this.userCalculationPowerLimit = userCalculationPowerLimit;
	}

	public String getFrameworksUrl() {
		return frameworksUrl;
	}

	public void setFrameworksUrl(String frameworksUrl) {
		this.frameworksUrl = frameworksUrl;
	}

	public Integer getDayMaxDebugJobs() {
		return dayMaxDebugJobs;
	}

	public void setDayMaxDebugJobs(Integer dayMaxDebugJobs) {
		this.dayMaxDebugJobs = dayMaxDebugJobs;
	}

	public String getRestServerUrl() {
		return restServerUrl;
	}

	public String getTensorboardUrl() {
		return tensorboardUrl;
	}

	public void setTensorboardUrl(String tensorboardUrl) {
		this.tensorboardUrl = tensorboardUrl;
	}

	public String getTensorboardDomain() {
		return tensorboardDomain;
	}

	public void setTensorboardDomain(String tensorboardDomain) {
		this.tensorboardDomain = tensorboardDomain;
	}

	public String getUserCenterTsbUrl() {
		return userCenterTsbUrl;
	}

	public void setUserCenterTsbUrl(String userCenterTsbUrl) {
		this.userCenterTsbUrl = userCenterTsbUrl;
	}

	public Long getExampleProjectId() {
		return exampleProjectId;
	}

	public String getExampleProjectJobIds() {
		return exampleProjectJobIds;
	}
}
